<?php
/* this could be done in an iframe with a meta refresh tag and a transition tag.
the ideal aspect of that would be the new ads each time
*/

$page = -1;
if (isset($_REQUEST['page']))
	$page = $_REQUEST['page'];

if ($page == 0)
	$page = -1;

?>



<?php
	$access_token = $_SESSION['access_token'];

/* Create a TwitterOauth object with consumer/user tokens. */
	$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);

	//need to get followers
	$jsonDecode = $connection->get('statuses/followers', array('cursor' => $page));

//print_r($jsonDecode);

?>
<span id="timelinetitle"><?php echo $access_token['screen_name']; ?></span>&nbsp;&nbsp;<span id="timelinecount"><?php echo count($jsonDecode->users); ?> followers</span>
<hr id="simplehr" />
<table id="timelinetable" cellspacing="0" cellpadding="5">
<?php
	foreach ((array)$jsonDecode->users as $timelineEntry)
	{
?>
	<tr>
	<td valign="top">
		<a class="dock-item2" href="http://www.twitter.com/<?php echo $timelineEntry->screen_name; ?>"><img src="<?php echo $timelineEntry->profile_image_url; ?>" alt="(~.~)" title="<?php echo $timelineEntry->description;?>" width="48" height="48" border="0" /></a><form action="index.php" method="GET"><input type="hidden" name="start" value="prune" /><input type="hidden" name="tuser" value="<?php echo $timelineEntry->id; ?>" /><input type="hidden" name="tusername" value="<?php echo $timelineEntry->screen_name; ?>" /><input type="image" src="images/pruneicon.jpg" alt="Prune <?php echo $timelineEntry->screen_name; ?>" title = "Prune <?php echo $timelineEntry->screen_name; ?>" value="p" /></form>	
	</td>
	<td valign="top"><a href="http://www.twitter.com/<?php echo $timelineEntry->screen_name; ?>"><?php echo $timelineEntry->screen_name; ?></a><br /> <?php echo $timelineEntry->description; ?> </td>
	<td align="right" valign="top">Actions: </td><td valign="top">
<form action="post.php" method="post">
<input type="hidden" value="actions" name="redirect" />

	<select name="rawtweet" onChange="this.form.submit();">
		<option value="@<?php echo $access_token['screen_name']; ?> just kicked @<?php echo $timelineEntry->screen_name; ?>">Kick</option>
		<option value="@<?php echo $access_token['screen_name']; ?> just gave @<?php echo $timelineEntry->screen_name; ?> a hug">Hug</option>
		<option value="@<?php echo $access_token['screen_name']; ?> just bit @<?php echo $timelineEntry->screen_name; ?>">Bite</option>
		<option value="@<?php echo $access_token['screen_name']; ?> just piggybacked @<?php echo $timelineEntry->screen_name; ?>">Piggyback</option>
		<option value="@<?php echo $access_token['screen_name']; ?> just karate chopped @<?php echo $timelineEntry->screen_name; ?>">Karate Chop</option>
		<option value="@<?php echo $access_token['screen_name']; ?> just snuggled up with @<?php echo $timelineEntry->screen_name; ?>">Snuggle</option>
<option value="@<?php echo $access_token['screen_name']; ?> just congratulated @<?php echo $timelineEntry->screen_name; ?>">Congratulate</option>
<option value="@<?php echo $access_token['screen_name']; ?> just gave @<?php echo $timelineEntry->screen_name; ?> a high five">High Five</option>
<option value="@<?php echo $access_token['screen_name']; ?> just gave @<?php echo $timelineEntry->screen_name; ?> a #poopfacedsandwich">Poop-faced Sandwich</option>
	</select>
</form>
	</td>
	</tr>
	<tr>
		<td colspan="4"><hr id="simplehr" /></td>
	</tr>
<?php
	
	}
	
?> 
	<tr>
		<td>
			
		</td>
		<td colspan="3">
			<form action="index.php" method="GET">
			<input type="hidden" name="start" value="actions" />
			<input type="hidden" name="page" value="<?php echo $jsonDecode->previous_cursor; ?>" />
			<input type="submit" value="back" id="pagebutton" />
			</form>			
			<form action="index.php" method="GET">
			<input type="hidden" name="start" value="actions" />
			<input type="hidden" name="page" value="<?php echo $jsonDecode->next_cursor; ?>" />
			<input type="submit" value="next" id="pagebutton" />
			</form>
		</td>
	</tr>
</table>
